module.exports = (sequelize, DataTypes) => {
  const repair_type = sequelize.define(
    'repair_type',
    {
      id: {
        type: DataTypes.INTEGER(11),
        primaryKey: true,
        autoIncrement: true
      },
      repairName: {
        type: DataTypes.STRING(255),
        allowNull: false,
        field: "repair-name"
      }
    },
    {
      tableName: 'repair_type',
      timestamps: false,//使用事务时，出现Unknown column 'created_at' in 'field list'，原因是sequelize默认会自动为其添加 createdAt 和updatedAt column值，添加timestamp处理
    },
  )
  repair_type.associate = (models) => {//定义外键关联
    repair_type.belongsTo(
      models.repair_service,
      {foreignKey: 'id'}
    );
  }
  return repair_type;
};